<template>
  <div class="index-news-detail clearfix">
   <!-- banner -->
    <div class="banner">
      <img src="../../assets/images/banner.png" alt />
    </div>
    <div class="box clearfix">
    <div class="location">
      <router-link to="/policy">{{$t('common.nav.policy')}}</router-link>
      <span class="sp">></span>
      <router-link to="/c_policy_list?type=policySending" v-if="tabStatus=='policySending'">{{$t('common.policy.publication')}}</router-link>
      <router-link to="/c_policy_list?type=policyDecode" v-if="tabStatus=='policyDecode'">{{$t('common.policy.analyzing')}}</router-link>
      <router-link to="/c_policy_list?type=policyDeclare" v-if="tabStatus=='policyDeclare'">{{$t('common.leftNav.policy')}}</router-link>
      <router-link to="/c_policy_list?type=policyRecommend" v-if="tabStatus=='policyRecommend'">{{$t('common.policy.match')}}</router-link>
      <router-link to="/c_policy_list?type=policyCash" v-if="tabStatus=='policyCash'">{{$t('common.policy.fulfillment')}}</router-link>
      <span class="sp">></span>
      {{$t('news.detail')}}
    </div>
    <div class="content">
      <!-- 新闻标题 -->
      <div class="news-tit tc font22">
        {{con.title}}
      </div> 
      <div class="time tc h88">{{$t('news.releaseTime')}}：{{con.releaseTime || con.createTime}}</div>
      <div class="con" v-html="con.content"></div>
    </div>
    </div>
  </div>
</template>
<script>
import {ajax,showToast} from '@/utils/js.js'
import {policyDecodeDetail, policySendingDetail,} from '@/services/api.js'
import mainLes from '@/components/detail.vue'
const log = console.logs
export default {
  components:{
    mainLes
  },
  data() {
    return {
      type:'policyDecode',
      con:{},
      id:'', //文章id
      tabStatus:'',
    }
  },
  mounted(){
    let data = this.$route.query;
    this.type = data.type;
    this.id = data.id;
    this.tabStatus = data.type;
    this.content(data.id)
  },
  computed:{
    nav(){
      let data=[
        {name:this.$t('news.schooleHz'),id:0},
        {name:this.$t('news.companyHz'),id:1},
        {name:this.$t('news.joinCompany'),id:1}
      ]
      return data
    },
  },
  watch:{
    '$i18n.locale'(){
      this.content()
    },
  },
  methods:{
    tab(e){
      this.type = e.id
      
    },
    content(id = this.id){
      if(this.type=='policyDecode'){
        ajax(this,policyDecodeDetail,{id},res=>{
          this.con=res.data;
        },err=>{
          showToast(this,err.msg)
        })
      }else if(this.type=='policySending'){
        ajax(this,policySendingDetail,{id},res=>{
          this.con=res.data;
        },err=>{
          showToast(this,err.msg)
        })
      }
    },
    //首页跳转
    indexLink(data){
     if(data.outLink && data.outLink==1){
        window.open(data.linkUrl,'-blank')
      }else{
        window.location.href = data.linkUrl
      }
    },
    
  }
}
</script>
<style lang="scss">
  .index-news-detail{
    .banner {
      img {
        max-width: 100%;
        min-width: 1200px;
        display: block;
      }
      .el-carousel--button {
        width: 12px;
        height: 12px;
        background: rgba(255, 255, 255, 1);
        border-radius: 50%;
        opacity: 1;
      }
      .el-carousel--indicator.is-active button {
        background-color: #0f54bc;
      }
    }
    .content{
      padding:40px 120px;
      background-color: #fff;
      .time{
        padding: 20px 0;
      }
      .con{line-height: 1.8;color: #666;}
    }
    
    
  }
</style>